{% set pypi_name = 'keystonemiddleware' %}
{% set upstream_version = upstream_version('9.2.0') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        Middleware for OpenStack Identity
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/{{ pypi_name }}
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('WebOb') }}
BuildRequires:  {{ py3('WebTest') }}
BuildRequires:  {{ py3('cryptography') }}
BuildRequires:  {{ py3('fixtures') }}
BuildRequires:  {{ py3('keystoneauth1') }}
BuildRequires:  {{ py3('python-keystoneclient') }}
BuildRequires:  {{ py3('mock') }}
BuildRequires:  {{ py3('oslo.cache') }}
BuildRequires:  {{ py3('oslo.config') }}
BuildRequires:  {{ py3('oslo.context') }}
BuildRequires:  {{ py3('oslo.i18n') }}
BuildRequires:  {{ py3('oslo.messaging') }}
BuildRequires:  {{ py3('oslo.serialization') }}
BuildRequires:  {{ py3('oslo.utils') }}
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('pycadf') }}
BuildRequires:  {{ py3('python-memcached') }}
BuildRequires:  {{ py3('requests') }}
BuildRequires:  {{ py3('requests-mock') }}
BuildRequires:  {{ py3('six') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('stevedore') }}
BuildRequires:  {{ py3('testresources') }}
BuildRequires:  {{ py3('testtools') }}
BuildArch:      noarch

%description
This package contains middleware modules designed to provide authentication
and authorization features to web services other than Keystone
The most prominent module is keystonemiddleware.auth_token. This package
does not expose any CLI or Python API features.

%package -n python3-keystonemiddleware
Summary:        Middleware for OpenStack Identity
Requires:       {{ py3('WebOb') }}
Requires:       {{ py3('keystoneauth1') }}
Requires:       {{ py3('python-keystoneclient') }}
Requires:       {{ py3('oslo.cache') }}
Requires:       {{ py3('oslo.config') }}
Requires:       {{ py3('oslo.context') }}
Requires:       {{ py3('oslo.i18n') }}
Requires:       {{ py3('oslo.log') }}
Requires:       {{ py3('oslo.messaging') }}
Requires:       {{ py3('oslo.serialization') }}
Requires:       {{ py3('oslo.utils') }}
Requires:       {{ py3('pycadf') }}
Requires:       {{ py3('python-memcached') }}
Requires:       {{ py3('requests') }}
Requires:       {{ py3('six') }}

%description -n python3-keystonemiddleware
This package contains middleware modules designed to provide authentication
and authorization features to web services other than Keystone
The most prominent module is keystonemiddleware.auth_token. This package
does not expose any CLI or Python API features.

This package contains the Python 3.x module

%package -n {{ py2name('keystonemiddleware') }}-doc
Summary:        Documentation for Middleware for OpenStack Identity
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}
BuildRequires:  {{ py3('sphinxcontrib-apidoc') }}
BuildRequires:  {{ py3('sphinxcontrib-svg2pdfconverter') }}

%description -n {{ py2name('keystonemiddleware') }}-doc
Documentation for Middleware for OpenStack Identity.

%prep
%autosetup -p1 -n {{ pypi_name }}-{{ upstream_version }}
%py_req_cleanup

%build
%{py3_build}

%install
%{py3_install}

# generate html docs
export PYTHONPATH=.
PBR_VERSION=%{version} %sphinx_build -b html doc/source doc/build/html
# remove the sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}

%check
python3 -m stestr.cli run

%files -n python3-keystonemiddleware
%license LICENSE
%doc ChangeLog README.rst
%{python3_sitelib}/{{ pypi_name }}
%{python3_sitelib}/*.egg-info

%files -n {{ py2name('keystonemiddleware') }}-doc
%doc doc/build/html
%license LICENSE

%changelog
